// vim: ft=glsl noet ts=4 sw=4 sts=0
#version 330 core
smooth out vec3 uv[14];
layout(location = 0) in vec2 position;
uniform sampler2D tex;
uniform vec2 dir;

void populate_uv(int off, int lod)
{
	vec3 ndir = vec3(dir / textureSize(tex, lod), 0);
	uv[off  ] = vec3(position*0.5 + 0.5, lod);
	uv[off+1] = uv[off] -   ndir;
	uv[off+2] = uv[off] +   ndir;
	uv[off+3] = uv[off] - 2*ndir;
	uv[off+4] = uv[off] + 2*ndir;
	uv[off+5] = uv[off] - 3*ndir;
	uv[off+6] = uv[off] + 3*ndir;
}

void main()
{
	gl_Position = vec4(position, 0, 1);
	populate_uv(0, 3);
	populate_uv(7, 6);
}

